package com.workerhelping.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.SimpleFormatter;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnalyzeRecordMoneyVO {
    private Integer wId;
    private String name;
    private String gender;
    private Integer genderInt;
    @JsonFormat(pattern = "yyyy")
    private Date birthday;
    private Integer age;
    private Integer healthStatus;
    private Integer salary;
    private Integer srId;

    public Integer getGenderInt() {
        if (this.gender.equals("女"))
            return 0;
        else if (this.gender.equals("男"))
            return 1;
        else return null;
    }

    public Integer getAge() {
        String now = new SimpleDateFormat("yyyy").format(new Date());
        String bir = new SimpleDateFormat("yyyy").format(this.birthday);
        return Integer.parseInt(now) - Integer.parseInt(bir);
    }
}
